package com.eclipse.e0112_json.对象转json字符串;

import java.util.ArrayList;
import java.util.List;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

public class Test1 {
	public static void main(String[] args) throws JsonProcessingException {

		Student3 s = new Student3();
		Student3 s1 = new Student3();
		s.setName("qq");
		s1.setName("aa");
		List<Student3> result = new ArrayList<>();

		result.add(s);
		result.add(s1);

		ObjectMapper objectMapper = new ObjectMapper();
		String aa = objectMapper.writeValueAsString(result);
		System.out.println(aa);
	}


}

class Student3 {
	private String name;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

}
